<div class="user-index page-content ">
	<form nz-form [formGroup]="validateForm" class="page-header">
		<div nz-row [nzGutter]="24">
			<div nz-col [nzSpan]="6">
				<nz-form-item>
					<nz-form-label nzFor="userCode">用户编码</nz-form-label>
					<nz-form-control>
						<input nz-input placeholder="请填写" formControlName="userCode" />
					</nz-form-control>
				</nz-form-item>
			</div>
			<div nz-col [nzSpan]="6">
				
				<nz-form-item>
					<nz-form-label nzFor="typeIdList">用户种类</nz-form-label>
					<nz-form-control>
						<nz-select formControlName="typeIdList" nzPlaceHolder="请选择" nzAllowClear [nzMode]="'multiple'">
							<nz-option *ngFor="let toolType of toolTypeList" [nzLabel]="toolType.name"  [nzValue]="toolType.id"></nz-option>
						</nz-select>
					</nz-form-control>
				</nz-form-item>
			</div>
			<div nz-col [nzSpan]="6">
				<nz-form-item>
					<nz-form-label nzFor="warehouseId">仓库</nz-form-label>
					<nz-form-control>
						<!-- <input nz-input placeholder="请填写" formControlName="warehouseId" /> -->
						<nz-tree-select style="width: 100%" [nzDropdownStyle]="{'max-height': '300px'}"
							formControlName="warehouseId" [nzNodes]="warehouseNodes" nzCheckStrictly nzShowSearch
							nzCheckable nzPlaceHolder="请选择仓库">
						</nz-tree-select>
					</nz-form-control>
				</nz-form-item>
			</div>
			<div nz-col [nzSpan]="6">
				<nz-form-item style="float: right;">
					<a class="expand" (click)="expand = !expand; calcTableHeight();">
						<span>{{expand ? '收起' : '展开'}}</span>
						<i [ngClass]="{'down-expand': expand}" nz-icon nzType="down" nzTheme="outline"></i>
					</a>
					<button nz-button style="margin-right: 10px;" (click)="onSearch(true)">
						<!-- <i nz-icon nzType="search"></i> -->
						搜索
					</button>
					<button nz-button style="margin-right: 10px;" nzType="primary" (click)="create()">
						<!-- <i nz-icon nzType="plus"></i> -->
						新增
					</button>
					<button nz-button nzType="primary" (click)="batch()">
						<!-- <i nz-icon nzType="plus"></i> -->
						批量配置
					</button>
				</nz-form-item>
			</div>
		</div>
		<div nz-row [nzGutter]="24" [ngClass]="{'expand-active': expand, 'expand-content' : true}">
			<div nz-col [nzSpan]="6">
				<nz-form-item>
					<nz-form-label nzFor="userName">用户名称</nz-form-label>
					<nz-form-control>
						<input nz-input placeholder="请填写" formControlName="userName" />
					</nz-form-control>
				</nz-form-item>
			</div>
			<div nz-col [nzSpan]="6">
				<nz-form-item>
					<nz-form-label nzFor="forbidden">是否禁用</nz-form-label>
					<nz-form-control>
						<!-- <nz-switch formControlName="fixedAsset"  [nzCheckedChildren]="'是'" [nzUnCheckedChildren]="'否'"></nz-switch> -->
						<nz-select formControlName="forbidden" nzPlaceHolder="请选择" nzAllowClear>
							<nz-option nzLabel="是" [nzValue]="true"></nz-option>
							<nz-option nzLabel="否" [nzValue]="false"></nz-option>
						</nz-select>
					</nz-form-control>
				</nz-form-item>
			</div>

		</div>

	</form>


	<nz-table class="table-container" #basicTable [nzData]="data" [nzBordered]="true" [nzShowPagination]="false" nzSize="middle"
		[nzScroll]="{y:  tableScrollHeight }" [nzLoading]="nzLoading">
		<thead>
			<tr>
				<th nzAlign="center" nzWidth="60px">序号</th>
				<th nzAlign="center" nzWidth="100px">用户编码</th>
				<th nzAlign="center" nzWidth="90px">用户名称</th>
				<th nzAlign="center" nzWidth="150px">部门名称</th>
				<th nzAlign="center" nzWidth="240px">邮箱地址</th>
				<th nzAlign="center" nzWidth="150px">用户种类</th>

				<th nzAlign="center" nzWidth="auto">人员仓库</th>
				<th nzAlign="center" nzWidth="90px">是否禁用</th>

				<th nzAlign="center" nzWidth="120px">操作</th>
			</tr>
		</thead>
		<tbody>
			<tr *ngFor="let item of data;let i = index">
				<td nzAlign="center">
					{{i + 1}}
				</td>
				<td nzAlign="center">
					{{item.code || '-'}}
				</td>
				<td nzAlign="center">
					{{item.name || '-'}}
				</td>
				<td nzAlign="center">
					{{item.deptName || '-'}}
				</td>
				<td nzAlign="center">
					{{item.email || '-'}}
				</td>
				<td nzAlign="center"  style="padding: 0 0 5px 0;">
					<ng-container *ngFor="let type of item.types">
						<nz-tag *ngIf="type?.name" style="margin-top: 5px;" nzColor="success">{{type?.name}}</nz-tag>
					</ng-container>
				</td>
				<td nzAlign="center" style="padding: 0 0 5px 0;">
					<ng-container *ngFor="let wh of item.warehouses">
						<nz-tag *ngIf="wh?.name" style="margin-top: 5px;" nzColor="processing">{{wh?.name}}</nz-tag>
					</ng-container>
				</td>
				<td nzAlign="center">
					{{item.forbidden ? '是' : '否'}}
				</td>
				<td nzAlign="center">
					<a (click)="create(item)">编辑</a>
					<!-- <nz-divider nzType="vertical"></nz-divider>
					<a nz-popconfirm nzPopconfirmTitle="确定删除吗?" (nzOnConfirm)="del(item)">删除</a> -->
				</td>
			</tr>
		</tbody>
	</nz-table>

	<div class="page-pagination">
		<span *ngIf="page?.total">共{{page?.total}}条数据</span>
		<nz-pagination [(nzPageIndex)]="page.page" [nzTotal]="page.total" nzShowQuickJumper nzShowSizeChanger
			[(nzPageSize)]="page.size" (nzPageIndexChange)="onSearch()" (nzPageSizeChange)="onSearch(true)">
		</nz-pagination>
	</div>

</div>